package leetcode.code2087;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int minCost(int[] startPos, int[] homePos, int[] rowCosts, int[] colCosts) {
		int ans = 0;
		int a = startPos[0], b = startPos[1];
		int x = homePos[0], y = homePos[1];
		for (int i = Math.min(a, x) + 1; i < Math.max(a, x); i++) {
			ans += rowCosts[i];
		}
		ans += a == x ? 0 : rowCosts[x];
		for (int i = Math.min(b, y) + 1; i < Math.max(b, y); i++) {
			ans += colCosts[i];
		}
		ans += b == y ? 0 : colCosts[y];
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
